<?php
$postuladosV = "[";
$contratadosV = "[";
$ciudadV = "[";
arsort($postulados,SORT_STRING ); //ordeno la matriz de forma inversa
$totalV = 0;
foreach($postulados as $ciudad => $total){
    $postuladosV .= $total.",";
    $contratadosV .= $contratados[$ciudad].",";
    $ciudadV .= "\"$ciudad\"".",";
    $totalV += $total;
}
$postuladosV = trim($postuladosV, ",")."]";
$contratadosV = trim($contratadosV, ",")."]";
$ciudadV = trim($ciudadV, ",")."]";

?>
<script type="text/javascript">
        r = Raphael("holder", 1240, 600);
        r.g.txtattr.font = "12px 'Fontin Sans', Fontin-Sans, sans-serif";
        r.g.text(320, 100, "<?php echo "$titulo: ".$totalV; ?>").attr({"font-size": 20});
        var states = <?php echo $ciudadV; ?>;
        var fin = function () {
                this.flag = r.g.popup(this.bar.x, this.bar.y, this.bar.value || "0").insertBefore(this);
            };
        var fout = function () {
                this.flag.animate({opacity: 0}, 300, function () {this.remove();});
            };

        r.g.barchart(0, 200, 550, 250, [<?php echo $postuladosV; ?>, <?php echo $contratadosV; ?>], { stacked: false }).hover(fin, fout).
            label([states], true);
    </script>
